package com.xindz.hgq.utils.imgae;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;

import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.lztx.shared.shared.util.glide.GlideRequest;
import com.lztx.shared.shared.util.glide.GlideRequests;

import java.io.File;

import static com.xindz.hgq.utils.imgae.ImageType.ITYPE_BITMAP;
import static com.xindz.hgq.utils.imgae.ImageType.ITYPE_DRAWABLE;
import static com.xindz.hgq.utils.imgae.ImageType.ITYPE_FILE;
import static com.xindz.hgq.utils.imgae.ImageType.ITYPE_GIF;

/**
 * @name HGQBase
 * @class name：com.xindz.hgq.utils.imgae
 * @describe describe
 * @anthor XINDZ
 * @time 2018/7/17 15:17
 * @change
 * @chang time
 * @class describe
 */
public class ImageHelper {
    private ImageHelper imageHelper;

    private @ImageType.Type
    int type;
    private GlideRequest<Bitmap> bitmapGlideRequest;
    private GlideRequest<Drawable> drawableGlideRequest;
    private GlideRequest<File> fileGlideRequest;
    private GlideRequest<GifDrawable> gifDrawableGlideRequest;


    public ImageHelper getInstance(GlideRequests requests, @ImageType.Type int imageType) {
        type = imageType;
        switch (type) {
            case ITYPE_BITMAP:
                bitmapGlideRequest = requests.asBitmap();
                break;
            case ITYPE_DRAWABLE:
                drawableGlideRequest = requests.asDrawable();
                break;
            case ITYPE_FILE:
                fileGlideRequest = requests.asFile();
                break;
            case ITYPE_GIF:
                gifDrawableGlideRequest = requests.asGif();
                break;
            default:
                break;

        }
        return imageHelper;
    }


}
